/*
 * @Author: your name
 * @Date: 2022-02-04 12:55:22
 * @LastEditTime: 2022-02-04 13:13:54
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \ts\03数组定义-类型别名.ts
 */
let a: number[] = [1, 2]
let a1: string[] = ['1', '2']

// 同时几种类型
let a2: (number | string)[] = [1, 2, 'df']
let a4: (number | string | object)[] = [1, 2, 'df', { name: 'df' }]

// 对象数组
let obj3: { name: string, age: number }[] = [{ name: '1', age: 1 }]


// 类型别名,处理相同类型的多个数组
type obj31 = {
    name: string,
    age: number
}
let obj32: obj31[] = [{ name: '1', age: 1 }]


// 类定义方式
class class3 {
    name: string
    age: number
}
let obj33: class3[] = [{ name: '1', age: 1 }]

// 元组 ， 元组会固定数组元素位置
let obj34: [string, string, number] = ['1', '2', 3]
// 元组一般不用，处理表格csv文件格式一致大的 ，一般才会有
let obj5: [string, string, number][] = [['name', 'age', 20]]

console.log(a4, obj32, obj33)



// 类
class A23  {
    name:string
    age:number
}

let a23 :A23 = {
    name:'1',
    age:2
}
let b23:A23 = new A23()

console.log(b23.age); // undefined